package es.islomar.poc.either;

import org.testng.annotations.Test;

import fj.data.Either;
import static org.testng.Assert.*;

public class EitherExampleTest {

	@Test
	public void catching_other_people_exceptions() {
	    
		Either<Exception, Integer> result = EitherExample.divide(4, 2);
	    assertEquals((long) 2, (long) result.right().value());
	    
	    Either<Exception, Integer> failure = EitherExample.divide(4, 0);
	    assertEquals("/ by zero", failure.left().value().getMessage());
	}
	
}
